<%@ page language="java" import="java.util.*, com.zjut.zs.util.tools.*,com.zjut.an.admin.manager.*, com.zjut.an.admin.dao.*,com.zjut.an.news.manager.*, com.zjut.an.news.dao.*,
com.zjut.an.config.manager.*, com.zjut.an.config.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" type="text/css" href="../plugins/layuiadmin/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
	<script src="js/city.js"></script>
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <style type="text/css">
  	.layui-form-select dl {
  		z-index:9999;
  	}
  </style>
</head>
<body>
<%
if (session.getAttribute("admin") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='AdminLogin.html';</script>");
	out.close();
	return;
} 
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
HTMLCreat html = (HTMLCreat) SpringContextUtil.getBean("HTMLCreat");
ZsHTMLCreat zhtml = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
AnNewsManager manager = (AnNewsManager) SpringContextUtil.getBean("AnNewsManager");
int neId = Integer.parseInt(request.getParameter("neId"));
AnNews obj = manager.getData(neId);

%>
<form class="layui-form" action="">
  <div class="layui-form-item">
    <label class="layui-form-label">新闻标题</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="title" autocomplete="off" lay-verify="required" placeholder="请输入标题" class="layui-input" value="<%=obj.getTitle() %>">
    </div>
  </div>
  
  <div class="layui-form-item">
  	<div class="layui-inline">
	    <label class="layui-form-label">所属栏目</label>
	    <div class="layui-input-block">
	    	<select name="wcId" lay-filter="aihao" lay-verify="required" style="z-index:100">
	      	<%=html.getClassSelectHTML(obj.getAnWebclass().getWcId(), ((AnAdmin)session.getAttribute("admin")).getAdId()) %> 
	      	</select>
	    </div>
    </div>
    <div class="layui-inline">
	    <label class="layui-form-label">来源</label>
	    <div class="layui-input-block">
	      <input type="text" name="author" id="author" autocomplete="off" class="layui-input" value="<%=obj.getAuthor() %>">
	    </div>
    </div>
    <div class="layui-inline">
	    <label class="layui-form-label">发布时间</label>
	    <div class="layui-input-block">
	      <input type="text" name="adddate" id="adddate" autocomplete="off" class="layui-input" value="<%=obj.getAdddate() %>">
	    </div>
    </div>
  </div>
  
  <div class="layui-form-item">
    <div class="layui-inline">
	    <label class="layui-form-label">首页显示</label>
	    <div class="layui-input-block">
			<input type="radio" name="isrecommend" value="推荐" title="推荐" <%if("推荐".equals(obj.getIsrecommend()))out.print("checked"); %>>
	      <input type="radio" name="isrecommend" value="否" title="否" <%if("否".equals(obj.getIsrecommend()))out.print("checked"); %>>
	    </div><i>推荐才在学生端显示</i>
    </div>
    <div class="layui-inline">
	    <label class="layui-form-label">URL</label>
	    <div class="layui-input-block">
	    <input class="form-control" name="titleurl" type="text" id="titleurl" value="<%=obj.getTitleurl() %>" />  
	    </div>
    </div>
  </div>
  
	<div class="layui-form-item">  
		<div class="layui-inline">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
	    <!-- 加载编辑器的容器 -->
	    <script id="container" name="neContent" style="width:1000px" type="text/plain"><%=obj.getNeContent() %></script>
	    <!-- 配置文件 -->
	    <script type="text/javascript" src="../plugins/ueditor/ueditor.config.js"></script>
	    <!-- 编辑器源码文件 -->
	    <script type="text/javascript" src="../plugins/ueditor/ueditor.all.js"></script>
	    <!-- 实例化编辑器 -->
	    <script type="text/javascript">
	    var ue = UE.getEditor('container'); 
	    </script>
        </div>  
       </div>
   </div> 
  
		
  <div class="layui-form-item">
    <div class="layui-input-block">
    	<input type="text" name="adId" class="layui-input" value="<%=obj.getAdId()%>" style="display:none;">
    	<input type="text" name="neId" class="layui-input" value="<%=obj.getNeId()%>" style="display:none;">
    	<input type="text" name="ischeck" class="layui-input" value="<%=obj.getIscheck()%>" style="display:none;">
		<input type="text" name="hit" class="layui-input" value="<%=obj.getHit()%>" style="display:none;">
    	<input type="text" name="istop" class="layui-input" value="否" style="display:none;">
    	<input type="text" name="ishot" class="layui-input" value="否" style="display:none;">
    	<input type="text" name="score" class="layui-input" value="0" style="display:none;">
    	<input type="text" name="place" class="layui-input" value="0" style="display:none;">
    	<input type="text" name="del" class="layui-input" value="0" style="display:none;">
      	<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      	<button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
 
          
<script src="../plugins/layuiadmin/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	var $;
	layui.use(['jquery'], function(){ 
	   $ = layui.$;
	});
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  laydate.render({
	  elem: '#adddate' //指定元素
	  ,type: 'datetime'
	  ,value: new Date()
	});
  //监听提交
  form.on('submit(demo1)', function(data){
    var rowStr = data.field;
    rowStr.anWebclass={
    	wcId:rowStr.wcId
    };
    delete rowStr.wcId;
    $.ajax({
	  	type:"post",
	  	url:"../anNewsUpdate.action",
	  	data:{
	  		rowstr:JSON.stringify(rowStr)
	  	},
	  	async:true,
	  	cache:false,
	  	success:function(res){
	  		layer.msg('提交成功')
			setTimeout(function(){
                window.parent.location.reload();//修改成功后刷新父界面
            }, 1000);
	  	}
    });
    return false;
  });
  
});
</script>
</body>
</html>